package jfprincesstests.fakes;

import jfuzzyprincepless.agents.BaseNegotiationAgent;
import jfuzzyprincepless.zarchive.algorithm.structure.ICommandConstruction;
import jfuzzyprincepless.negotiation.IExecutionContext;
import jfuzzyprincepless.negotiation.INegotiationContext;

public class FakeActivator
	extends BaseNegotiationAgent
	implements ICommandConstruction
{
	private FakeActivationCmd fakeCmd;
	private StringBuilder sb;
	private String cmd;

	public FakeActivator(FakeActivationCmd fakeCmd) {
		super();
		this.fakeCmd = fakeCmd;
	}

	public FakeActivator(StringBuilder sb, String cmd) {
		super();
		this.sb = sb;
		this.cmd = cmd;
	}

	public FakeActivator(
		FakeActivationCmd fakeCmd,
		StringBuilder sb,
		String cmd
	) {
		super();
		this.fakeCmd = fakeCmd;
		this.sb = sb;
		this.cmd = cmd;
	}

	@Override
	public boolean negotiate(INegotiationContext context) {
		if (fakeCmd != null) {
			fakeCmd.activate();
		}
		if (sb != null) {
			sb.append(cmd);
		}
		return false;
	}

	@Override
	public void execute(IExecutionContext context) {}

	@Override
	public String toString() {
		return "FakeActivator " + fakeCmd;
	}
}
